<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<script>
// 面向对象思想
// 表现力的JSON 对象字面量
// let 变量 关键字
// key: value,
// typeof(获得变量类型)运用：typeof zxy.hobbies      object
let zxy = {
    name: "周星宇",                    //字符串 string
    hometown: "吉安",                  //字符串 string
    age: 18,                          //number 不适合计算 数值类型
    sex: "男",                        //字符串 string
    hobbies: ["看书", "编程", "旅游"], // object 
    isSingle: true,                   //boolean 
    job: null,                        // 空值 null
    sendFlower: function(target){     // function 函数
        target.receiveFlower(zxy);
    }
  }    
let a;                                // undefined 未定义
let xh ={
  xq: 30,
  name: "肖华",
  hometown: "南昌",
  age: 18,
  sex: "女",
  hobbies: ["绘画", "音乐", "舞蹈"],
  job: "学生",
  receiveFlower: function(sender){
    console.log('肖华收到了'+sender.name+'的花');
    if(this.xq < 80){
      console.log('不约，我们不约');
    } else {
      console.log('硕果走一波!!!');
    }
  }
}
let xm = {
  name: "萧媚",
  hometown: "赣州",
  receiveFlower: function(sender){
    setTimeout(function() {
      xh.xq = 90;
      xh.receiveFlower(sender);
    },3000)  
    // console.log('萧媚收到了'+sender.name+'的花');
    //xh.receiveFlower(sender);
    //作用？
    // if(sender.name === "周星宇"){
    //   console.log('让我们在一起吧......');
    // }

  }
}
</script>
</body>
</html>